package sz.szsmk.citizencard.mvp.presenter;

import javax.inject.Inject;

import sz.szsmk.citizencard.DaggerApplication;
import sz.szsmk.citizencard.model.network.bean.request.AccumPointReq;
import sz.szsmk.citizencard.model.network.bean.response.BaseBean;
import sz.szsmk.citizencard.model.network.bean.response.CalendarSignInRes;
import sz.szsmk.citizencard.mvp.ICalendarSignInMvpView;
import sz.szsmk.citizencard.mvp.ISignInMvpView;
import sz.szsmk.citizencard.mvp.dzsmkpresenter.AppBasePresenter;
import sz.szsmk.citizencard.retrofitrxjava.ErrorAction;
import sz.szsmk.citizencard.retrofitrxjava.NetworkDateSources;
import sz.szsmk.citizencard.retrofitrxjava.SubscribeResult;
import sz.szsmk.citizencard.util.ACache;

/**
 * author : hyt
 * date : 2019/8/28
 * description :
 */
public class CalendarSignInPresenter extends AppBasePresenter<ICalendarSignInMvpView> {

    private NetworkDateSources mNetworkDateSource;

    @Inject
    public CalendarSignInPresenter() {
        this.mNetworkDateSource = NetworkDateSources.getInstance();
    }

    public void getCalendarSignIn(){
        AccumPointReq accumPointReq  = new AccumPointReq();
        accumPointReq.setAccess_token(ACache.get(DaggerApplication.getIns()).getAsString("access_token"));
        mNetworkDateSource.getCalendarSignIn(accumPointReq, new SubscribeResult<CalendarSignInRes>() {
            @Override
            protected void onOk(CalendarSignInRes response) {
                getMvpView().getCalendarSignInSuccess(response);
            }

            @Override
            protected void onFailure(CalendarSignInRes response) {
            }
        }, new ErrorAction() {
            @Override
            public void onCall(Throwable throwable) {

            }
        });
    }

}
